//
//  LSCupScoreCell.m
//  LookScore
//
//  Created by warrior on 2018/7/10.
//  Copyright © 2018年 ChongQingXunTiCompany. All rights reserved.
//

#import "LSCupScoreCell.h"
@interface LSCupScoreCell()
@property (nonatomic, strong) NSMutableArray *lableArray;
@property (nonatomic, strong) UIImageView *logoImage;
@end


@implementation LSCupScoreCell


+(LSCupScoreCell *)CupScoreCellByTableView:(UITableView *)tableView{
    LSCupScoreCell *cell=[tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self)];
    if (!cell) {
        cell=[[LSCupScoreCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(self)];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }return cell;
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addContentView];
    }
    
    return self;
}

-(void)addContentView{
    //    NSArray *titleArray = @[@"16",@"莫斯科火车头",@"9",@"6",@"2",@"1",@"60",@"20",@"10"];
    CGFloat width=(LSScreenWidth-95)/4;
    UILabel *lable;
    for (int i=0; i<5; i++) {
        lable=[UILabel new];
        //        lable.text = titleArray[i];
        lable.textColor = LSTitleGrayColor1;
        lable.font=LSFontSize12;
        lable.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:lable];
        [self.lableArray addObject:lable];
        if (i==0) {
            lable.sd_layout.leftEqualToView(self.contentView).centerYEqualToView(self.contentView).widthIs(width).heightIs(30);
        }else if (i==1){
            lable.numberOfLines = 2;
            lable.sd_layout.leftEqualToView(self.contentView).offset(width*i).centerYEqualToView(self.contentView).widthIs(95).heightIs(30);
        }else{
            lable.sd_layout.leftEqualToView(self.contentView).offset(width+95+(i-2)*width).centerYEqualToView(self.contentView).widthIs(width).heightIs(30);
        }
    }
    
    UIView *lineView = [[UIView alloc] init];
    lineView.backgroundColor = LSLineGrayColor;
    [self.contentView addSubview:lineView];
    lineView.sd_layout.leftEqualToView(self.contentView).bottomEqualToView(self.contentView).rightEqualToView(self.contentView).heightIs(0.5);
}
- (void)setModel:(LSCupScoreModel *)model{
    _model = model;
    NSArray *array = @[model.Rank,model.PlayerName,[NSString stringWithFormat:@"%@(%@)",model.TotalGoal,model.DianQiu],model.Home,model.Guest];
    [self.lableArray enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        UILabel *lable = (UILabel *)obj;
        lable.text = array[idx];
    }];
//    [self.logoImage sd_setImageWithURL:[NSURL URLWithString:TeamImageHeaderUrl((long)model.TeamId)] placeholderImage:nil];
}
- (NSMutableArray *)lableArray{
    if (!_lableArray) {
        _lableArray = [NSMutableArray array];
        
    }
    return _lableArray;
}
@end
